amd-iommu: Fix Guest CR3 Table following c/s 3a7947b6901
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 3 Apr 2019 16:53:15 +0000 (17:53 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 20 Nov 2020 19:25:58 +0000 (19:25 +0000)
commitb659a5cebd611dbe698e63c03485b5fe8cd964ad
tree7740d45a726670dc050636269c8f01dd072792fd
parent846d22d54f24f336fb80d052338e0cd030d54fee
amd-iommu: Fix Guest CR3 Table following c/s 3a7947b6901

"amd-iommu: use a bitfield for DTE" renamed iommu_dte_set_guest_cr3()'s gcr3
parameter to gcr3_mfn but ended up with an off-by-PAGE_SIZE error when
extracting bits from the address.

get_guest_cr3_from_dte() and iommu_dte_set_guest_cr3() are (almost) getters
and setters for the same field, so should live together.

Rename them to dte_{get,set}_gcr3_table() to specifically avoid 'guest_cr3' in
the name.  This field actually points to a table in memory containing an array
of guest CR3 values.  As these functions are used for different logical
indirections, they shouldn't use gfn/mfn terminology for their parameters.
Switch them to use straight uint64_t full addresses.

Fixes: 3a7947b6901 ("amd-iommu: use a bitfield for DTE")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/drivers/passthrough/amd/iommu.h
xen/drivers/passthrough/amd/iommu_guest.c
xen/drivers/passthrough/amd/iommu_map.c